import request from "@/util/request";

/**
 * 获取订单防重令牌
 * @returns {*}
 */
export function getOrderTokenApi(){
    return request({
        method:'get',
        url:'order/token',
    })
}
/**
 * 保存订单
 * @param data
 * @returns {*}
 */
export function saveOrderApi(data){
    return request({
        method:'post',
        url:'order/save',
        data
    })
}

/**
 * 获取订单详情
 * @param orderId
 * @returns {*}
 */
export function getOrderById(orderId){
    return request({
        method:'get',
        url:'order/get/orderInfo',
        params: {orderId:orderId}
    })
}

/**
 * 获取订单评价的vo数据
 * @param orderId
 * @returns {*}
 */
export function getOrderAppraiseVoApi(orderId){
    return request({
        method:'get',
        url:'order/orderAppraiseVo',
        params: {orderId}
    })
}

/**
 * 查询当前用户的订单列表（根据订单状态）
 * @param pageInfo
 * @param status
 * @returns {*}
 */
export function getOrderListByStatus(pageInfo,status){
    return request({
        method:'get',
        url:'order/get/orderList',
        params: {
            pageNum:pageInfo.pageNum,
            pageSize:pageInfo.pageSize,
            status
        }
    })
}

export function orderPay(orderId){
    return request({
        method:'post',
        url:'pay/ali',
        params: {
            orderId
        }
    })
}

export function orderReceive(orderId){
    return request({
        method:'post',
        url:'order/receive',
        params: {
            orderId
        }
    })
}
/**
 * 查询支付结果
 * @param orderId
 * @returns {*}
 */
export function queryOrderPay(orderId){
    return request({
        method:'get',
        url:'pay/result',
        params: {
            orderId
        }
    })
}


export function orderAppraiseApi(orderAppraiseVos){
    return request({
        method:'post',
        url:'order/goodsAppraise/save',
        data:orderAppraiseVos
    })
}
